﻿using ChuanYe.CountyFireManagement.EF.MySQL.Models;
using ChuanYe.CountyFireManagement.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChuanYe.CountyFireManagement.BLL
{
    public class FireCauseBLL
    {
        #region 构造单例
        private FireCauseBLL() { }
        private static FireCauseBLL _instance;
        public static FireCauseBLL Instance
        {
            get
            {
                return _instance ?? (_instance = new FireCauseBLL());
            }
        }
        #endregion

        public List<FireCauseModel> Get()
        {
            using (CountyFireManagementContext ef = new CountyFireManagementContext())
            {
                return ef.Firecause.OrderBy(o => o.Sort).ToList()
                        .Select(s=>new FireCauseModel { Key=s.CauseId,Value=s.CauseName,Sort=s.Sort }).ToList();
            }
        }
    }
}
